﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Genuilder.Extensibility
{
	public class RunResultError
	{
		public RunResultError(Exception ex, ExtensionContext extensionContext)
		{
			_Exception = ex;
			_Extension = extensionContext;
		}
		private readonly Exception _Exception;
		public Exception Exception
		{
			get
			{
				return _Exception;
			}
		}
		private readonly ExtensionContext _Extension;
		public ExtensionContext ExtensionContext
		{
			get
			{
				return _Extension;
			}
		}
	}
	public class RunResult
	{
		RunResultError _Error;
		public RunResult(ExecutionContext executionContext)
		{
			if(executionContext == null)
				throw new ArgumentNullException("executionContext");
			this._ExecutionContext = executionContext;
			_History = this._ExecutionContext.CreateHistory();
		}

		public RunResult(RunResultError error, Extensibility.ExecutionContext executionContext)
			: this(executionContext)
		{
			_Error = error;
		}

		public RunResultError Error
		{
			get
			{
				return _Error;
			}
		}

		ExecutionContext _ExecutionContext;
		public ExecutionContext ExecutionContext
		{
			get
			{
				return this._ExecutionContext;
			}
		}

		private readonly RunHistory _History;
		
		public RunHistory History
		{
			get
			{
				return _History;
			}
		}
	}
}
